/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package heartgame;

import GUI.GameplayForm;
import MiddleLayer.ClientProcessing;
import MiddleLayer.OtherClass.CommandStruct.MessageType;
import MiddleLayer.ServerProcessing;

/**
 *
 * @author ThanhTri
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here

        TestClientServer server1 = new TestClientServer(true);
        TestClientServer client1 = new TestClientServer(false);
        TestClientServer client2 = new TestClientServer(false);

        server1.start();
        client1.start();
        client2.start();


    }

}

class TestClientServer extends Thread
{
    ServerProcessing server = null;
    ClientProcessing clientProcessing = null;

    public TestClientServer(boolean bIsServer) {
        if(bIsServer)
            server = new ServerProcessing();
        else
            clientProcessing = new ClientProcessing();
    }

    @Override
    public void run()
    {
        if(server != null)
        {
            server.initServer();
        }
        else
        {
            clientProcessing.initGame();
            clientProcessing.sendMessageToServer(MessageType.Chat, "hello");
            
            while(true)
            {}
        }
    }

}
